package com.atguigu.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.atguigu.base.BaseDAO;
import com.atguigu.base.BaseServiceImpl;
import com.atguigu.dao.HouseUserDAO;
import com.atguigu.entity.HouseUser;
import com.atguigu.service.HouseUserService;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @PACKAGE_NAME: com.atguigu.service.impl
 * @CLASSNAME: HouseUserImpl
 * @AUTHOR: zhangsan
 * @DATE: 2024/4/23 16:14
 * @SINCE 17.0.7
 * @DESCRIPTION: HouseUserServiceImpl
 */
@Service(interfaceClass = HouseUserService.class)
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public class HouseUserServiceImpl extends BaseServiceImpl<HouseUser> implements HouseUserService {

    @Resource
    private HouseUserDAO houseUserDAO;
    @Override
    protected BaseDAO<HouseUser> getEntityDAO() {
        return houseUserDAO;
    }

    /**
     * 通过id查找该房源对应的房东
     *
     * @param id
     * @return
     */
    @Override
    public List<HouseUser> findListByHouseId(Long id) {
        List<HouseUser> houseUserList = houseUserDAO.findListByHouseId(id);
        return houseUserList;
    }
}
